
//
//  ThemeLabel.m
//  ThemeChange
//
//  Created by 花花 on 2016/12/8.
//  Copyright © 2016年 花花. All rights reserved.
//

#import "ThemeLabel.h"

@implementation ThemeLabel
- (instancetype)init{

    return [self initWithFrame:CGRectZero];

}

- (instancetype)initWithFrame:(CGRect)frame{

    if (self =[super initWithFrame:frame]) {
        [self setup];
    }
    
    return self;
}
- (void)awakeFromNib{
    [super awakeFromNib];
    [self setup];

}

- (void)setColorkeyName:(NSString *)colorkeyName{

    if (_colorkeyName != colorkeyName) {
    _colorkeyName = [colorkeyName copy];
    
    [self themeDidChange];
    }
    
    
    

}
- (void)setup{

    self.backgroundColor = [UIColor clearColor];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(themeDidChange) name:kThemeDidChangeNotification   object:nil];

}

-(void)dealloc{

    [[ NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)themeDidChange{

    self.textColor =[[ThemeManager shareManager] loadColorWithKeyName:_colorkeyName];
    


}
@end
